<template>
	<view>
	<view>
		<uni-nav-bar shadow left-icon="left" dark title="合同审核" @clickLeft="back()" />
		<uni-row >
			<uni-col :span="12">
				<uni-easyinput class="uni-mt-5" suffixIcon="search"  placeholder="审批单号" v-model="ReviewForm.approvalNum" @iconClick="iconClick"></uni-easyinput>
			</uni-col>
			
			<uni-col :span="12">
			<uni-data-select
			  v-model="ReviewForm.status"
			  :localdata="range"
			  @change="change"
			></uni-data-select></uni-col>
		</uni-row>
	</view>	
	<view v-for="(item,index) in from" :key="index">
		<uni-card >
		<uni-row class="box" >
			<text style="font-weight: 600;">审批单号:</text>{{item.approvalNum}}
		</uni-row>
		<uni-row class="box" >	
			<text style="font-weight: 600;">合同编号:</text>{{item.contractNum}}
		</uni-row>
		<uni-row class="box">
			<text style="font-weight: 600;">合同名称:</text>{{item.contractName}}
		</uni-row>
		<uni-row class="box">
			<text style="font-weight: 600;">单据类型:</text>{{item.orderType}}
		</uni-row>
		<uni-row class="box">
			<text style="font-weight: 600;">审批流程:</text>{{item.reviewProcess}}
		</uni-row>
		<uni-row class="box">
			<text style="font-weight: 600;">提交人:</text>{{item.realName}}
		</uni-row>
		<uni-row class="box">
			<view  v-if="item.status==0"><text style="font-weight: 600;">合同状态:</text><text>待审核</text></view>
			<view  v-if="item.status==1"><text style="font-weight: 600;">合同状态:</text><text >待审批</text></view>
			<view  v-if="item.status==2"><text style="font-weight: 600;">合同状态:</text><text>已通过</text></view>
			<view  v-if="item.status==3"><text style="font-weight: 600;">合同状态:</text><text>已驳回</text></view>
		</uni-row>
         <uni-row style="text-align: center;"><button size="mini" type="primary" @click="contract_detail(from[index])">查看详细</button></uni-row>
		</uni-card>
	
	</view>
	
	</view>
</template>

<script>
	import {reviewFormDatatable} from '@/api/system/user.js'
	export default {
		data() {
			return {
				from:null,
				ReviewForm:{
					page: 1,
					rows: 100,
					approvalNum:null,
					contractNum:null,
					status:'0'
					
				},
				range: [
					{"value": "","text": "所有"	},
					{"value": "0","text": "待审核"	},
					{"value":"1","text": "待审批"},
					// {"value":"2","text": "已通过"},
					// {"value":"3","text": "已驳回"},
					],
				
			}
		},
		onLoad() {
			this.get()
		},
		methods: {
			change(){
				this.get()
			},
			
			get(){
				reviewFormDatatable(this.ReviewForm).then(res=>{
				this.from=res.rows
				})
			},
			iconClick(){
				this.get()
			},
		back(){
		  this.$tab.reLaunch('/pages/work/purchaser/index')
		},
		contract_detail(e){
			uni.navigateTo({
			       url: '/pages/work/purchaser/contract_review_detail',
			       success: (respost) => {
			           // 通过eventChannel向被打开页面传送数据
			           respost.eventChannel.emit('acceptDataFromOpenerPage', {data:e},
					   )}
			     });
			
		}
		}
	}
</script>

<style>
.box {
 /*强制文本在一行内显示*/
 white-space:nowrap; 
 overflow:hidden; 
 text-overflow:ellipsis
}
</style>
